﻿using System;
class Animal
{
    public virtual void Voice()
    {
        Console.WriteLine("动物发出声音");
    }
}

class Cat : Animal
{
    public override void Voice()
    {
        Console.WriteLine("猫：喵喵喵");
    }
}

class Pig : Animal
{
    public override void Voice()
    {
        Console.WriteLine("猪：哼哼哼");
    }
}

class Dog : Animal
{
    public override void Voice()
    {
        Console.WriteLine("狗：汪汪汪");
    }
}

class Store
{
    public static Animal GetInstance(string animalType)
    {
        if (animalType == "dog")
        {
            return new Dog();
        }
        else if (animalType == "pig")
        {
            return new Pig();
        }
        else
        {
            return new Cat();
        }
    }
}

class Program
{
    static void Main(string[] args)
    {
        
        Animal dog = Store.GetInstance("dog");
        dog.Voice();
        Animal pig = Store.GetInstance("pig");
        pig.Voice();
        Animal cat = Store.GetInstance("cat");
        cat.Voice();
        Animal other = Store.GetInstance("other");
        other.Voice();
    }
}